package demo;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * 向文件写入一个字节
 */
public class HelloWorld {
    public static void main(String[] args) throws IOException {
        System.out.println("Hello World!");
        FileOutputStream fos = new FileOutputStream("fos.dat");
        String line = "我说乘着西风，出发啦！尼尔龙马！";
        fos.write(line.getBytes(StandardCharsets.UTF_8));
        fos.write('\n');
        line = "今夜，灵魂彼此相拥！";
        fos.write(line.getBytes(StandardCharsets.UTF_8));
        fos.write('\n');
        line="主线上新添加了一句写入内容";
        fos.write(line.getBytes(StandardCharsets.UTF_8));


        line="分支上又添加了一句写入操作，想造成冲突！！！";
        fos.write(line.getBytes(StandardCharsets.UTF_8));
        line="分支上又添加了一句写入操作，想造成冲突！！！";
        fos.write(line.getBytes(StandardCharsets.UTF_8));
        System.out.println("写出完毕");
        fos.close();
    }
}
